package com.socketeg.demo.socket;

import org.springframework.stereotype.Component;

import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * 管理客户端
 */

@Component
public class ManagerClient {

    private final static Map<String, Socket> clientList = new HashMap<>();

    public static void setClient(String name, Socket socket) {
        ManagerClient.clientList.put(name, socket);
    }

    public static Socket getClient(String name) {
        return ManagerClient.clientList.get(name);
    }

    public static void removeClient(String name){
        ManagerClient.clientList.remove(name);
    }
}
